package cn.diancan.exception;

/**
 * 从业务层传递出来的异常  --不是一个简单的异常
 * @author A
 */
@SuppressWarnings("serial")
public class OutMsgException extends Exception{
	
    /* Custom message for this exception */
	private Integer code;
	private String message;
	
	/**
	 * Constructor
	 */
	public OutMsgException(){
		this.code= OutMsgCode.ERROR.getCode();
		this.message = "Unknown Error";
	}
	
	/**
	 * Constructor with custom message
	 * @param message
	 */
	public OutMsgException(String message){
		this.code= OutMsgCode.ERROR.getCode();
		this.message = message;
	}
	
	public OutMsgException(OutMsgCode code,String message){
		this.code = code.getCode();
		this.message = message;
	}
	
	/**
	 * String representation
	 */
	public String toString(){
		return this.message;
	}

	public Integer getCode() {
		return code;
	}

	public String getMessage() {
		return this.message;
	}
	
	 

	
}
